﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using ZQNB.BaseLib.Core.Models;
using ZQNB.Common.Encrypt;
using ZQNB.Common.FileDbs;

namespace ZQNB.Tool.InitDataMaker
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            //NbEncryptHelper helper = new NbEncryptHelper();
            //NbEncryptHelper helper2 = new NbEncryptHelper();
            //int hashCode = helper.GetHashCode();
            //int hashCode2 = helper2.GetHashCode();

            //MessageBox.Show(hashCode + @" - " + hashCode2);
            //return;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Application.Run(new MainForm());


            var jsonFileDbHelper = new JsonFileDbHelper();
            PasswordEncryptor passwordEncryptor = new PasswordEncryptor(new NbEncryptHelper());

            var accounts = new List<SuperAccount>()
            {
                new SuperAccount(){
                Username = "super",
                Password = passwordEncryptor.Encrypt("123")
                }
            };

            jsonFileDbHelper.Save(accounts);

            var productInfos = new List<ProductInfo>(){
                new ProductInfo()
                {
                    ProductName = "纳博云平台",
                    Company = "中庆纳博",
                    Copyright = "All Rights Reserved. ",
                    SinceYear = "2011"
                }
            };
            jsonFileDbHelper.Save(productInfos);

            var aceSettings = new List<AceSetting>(){
                new AceSetting()
                {
                    FixedNavbar = true,
                    FixedSidebar = true,
                    FixedBreadcrumbs = true,
                    InsideContainer = true
                }
            };

            jsonFileDbHelper.Save(aceSettings);

            MessageBox.Show(@"DONE!");

        }
    }
}
